﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SCRUM.Core.DataProviders;
using SCRUM.Core.BusinessObjects;

namespace SCRUM.Core.DAO
{
    /// <summary>
    /// Data access object for availability of user 
    /// </summary>
    public static class DAOAvailability
    {

        /// <summary>
        /// Returns availability according to specified ID
        /// </summary>
        /// <param name="ID">ID of availability</param>
        /// <returns>The Availability</returns>
        public static Availability GetAvailabilityByID(int ID)
        {
            return ProviderFactory.Provider.GetAvailabilityByID(ID);
        }

        /// <summary>
        /// Returns availability for team in specific time range 
        /// </summary>
        /// <param name="teamID">Id of team</param>
        /// <param name="from">Start date</param>
        /// <param name="to">End date</param>
        /// <returns>List of availabilities</returns>
        public static List<Availability> GetAvailabilityForTeam(int teamID, DateTime from, DateTime to)
        {
            return ProviderFactory.Provider.GetAvailabilityForTeam(teamID, from, to);
        }

        /// <summary>
        /// Gets all availability records in defined time range
        /// </summary>
        /// <param name="from">Start date</param>
        /// <param name="to">End date</param>
        /// <returns>Availability records </returns>
        public static List<Availability> GetAvailabilities(DateTime from, DateTime to)
        {
            return ProviderFactory.Provider.GetAvailabilities(from, to);
        }

        /// <summary>
        /// Creates new instance of availability
        /// </summary>
        /// <param name="availability">availability</param>
        /// <returns>Created availability</returns>
        public static Availability CreateAvailability(Availability availability)
        {
            return ProviderFactory.Provider.CreateAvailability(availability);
        }

        /// <summary>
        /// Updates Availability
        /// </summary>
        /// <param name="availability">Start</param>
        public static void UpdateAvailability(Availability availability)
        {
            ProviderFactory.Provider.UpdateAvailability(availability);
        }

        /// <summary>
        /// Deletes specific availability
        /// </summary>
        /// <param name="ID">ID of availability</param>
        public static void DeleteAvailability(int ID)
        {
            ProviderFactory.Provider.DeleteAvailability(ID);
        }

        /// <summary>
        /// Gets all availability records for specific user in defined time range
        /// </summary>
        /// <param name="userID">ID of user</param>
        /// <param name="from">Start date</param>
        /// <param name="to">End date</param>
        /// <returns>Availability records for user</returns>
        public static List<Availability> GetAvailabilityForUser(int userID, DateTime from, DateTime to)
        {
            return ProviderFactory.Provider.GetAvailabilityForUser(userID, from, to);
        }
    }
}
